package Swing;

import DD.PP;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Param extends JFrame {

    public Param(){
        setTitle("dnf航海士");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    //置窗口是否可以关闭
        setSize(300,200);
        Container c=getContentPane();    //获取当前窗口的内容窗格
        JPanel panel = new JPanel();
        panel.setLayout(new GridLayout(3,1));

        JPanel jp1 = new JPanel();
        jp1.setLayout(new GridLayout(1,3));
        JLabel l1 = new JLabel("选择角色坐标");
        final JTextPane j1tx = new JTextPane();
        final JTextPane j1ty = new JTextPane();
        jp1.add(l1);
        jp1.add(j1tx);
        jp1.add(j1ty);

        JPanel jp2 = new JPanel();
        jp2.setLayout(new GridLayout(1,3));
        JLabel l2 = new JLabel("选择地图坐标");
        final JTextPane j2tx = new JTextPane();
        final JTextPane j2ty = new JTextPane();
        jp2.add(l2);
        jp2.add(j2tx);
        jp2.add(j2ty);

        JButton btn = new JButton("确定");

        btn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                PP p1 = new PP(j1tx.getText(),j1ty.getText());
                PP p2 = new PP(j2tx.getText(),j2ty.getText());
                new Frame(p1,p2);
            }
        });

        panel.add(jp1);
        panel.add(jp2);
        panel.add(btn);



        c.add(panel);
        setVisible(true);

    }

}
